<?php
/**
 * ViewAction 
 * 
 * 显示详细产品内容.
 *
 */
class ViewAction{
	
	public function action($_get){  
		require_once "Action/common.php";

		//获取分页信息

		$page_num = 1;
		if($_get['page']){$page_num = $_get['page'];}

		$iid = '';
		if($_get['iid']){
			$iid = $_get['iid'];
			$iid = getNoiseCid($iid);
		}else{
			exit("输入的参数有错误！");
		}

		$keyword = '';
		if($_get['keyword']){$keyword = $_get['keyword'];}


		$Taoapi->method = 'taobao.taobaoke.items.detail.get';
		$Taoapi->fields = 'iid,detail_url,num_iid,title,nick,pic_url,type,cid,seller_cids,props,input_pids,input_str,desc,pic_path,num,valid_thru,list_time,delist_time,stuff_status,location,price,post_fee,express_fee,ems_fee,has_discount,freight_payer,has_invoice,has_warranty,has_showcase,modified,increment,auto_repost,approve_status,postage_id,product_id,auction_point,property_alias,itemimg,propimg,sku,outer_id,is_virtural,is_taobao,is_ex,video,click_url,shop_click_url,seller_credit_score';
		$Taoapi->num_iids = $iid;
		$Taoapi->nick = USERNICK;	//配制文件中的nick

		//需要更多的字段可以登陆 taoapi.com 进行配置生成
		$TaobaokeData = $Taoapi->Send('get','xml')->getArrayData();

		$show_array=array();
		$show_array= $TaobaokeData['taobaoke_item_details']['taobaoke_item_detail'];

		//正则表达式
		$patten = "/(?<=href=)([^\>]*)(?=\>)/i";
		$source = $show_array['item']['desc'];
		$link = $show_array['click_url'];
		$des = preg_replace($patten,$link,$source);

		//设定变量	
		$click_url = isBaidu()?"#":$show_array['click_url'];
		$shop_click_url = isBaidu()?"#":$show_array['shop_click_url'];



		$ititle = $show_array['item']['title'];
		$icid = SITEPATH."index.php/List/cid/".addNoise($d,$show_array['item']['cid']);

		$tpl->assign("mm_index_key",$show_array['item']['nick'].",".$ititle);
		$tpl->assign("mm_index_des",$show_array['item']['desc']);
		$tpl->assign("mm_beian",ICPBEIAN);
		$tpl->assign("item",$show_array);
		$tpl->assign("mm_webname",SITETITLE);
		$tpl->assign("siteflag",FLAG);								//设定站点标记
		
		$tpl->assign("mm_nav",$list['nav']);
		$tpl->assign("mm_click_url",$click_url);
		$tpl->assign("mm_shop_click_url",$shop_click_url);

		$tpl->assign("mm_infocatid",$icid);
		$tpl->assign("mm_infocredit",$show_array['seller_credit_score']);
		$tpl->assign("mm_infotitle",$show_array['item']['title']);
		$tpl->assign("mm_infomoney",$show_array['item']['price']);
		$tpl->assign("mm_urlinfonick",$show_array['item']['nick']);
		$tpl->assign("mm_infonick",$show_array['item']['nick']);
		$tpl->assign("mm_infotime",$show_array['item']['delist_time']);
		$tpl->assign("mm_infostate",$show_array['item']['location']['state']);
		$tpl->assign("mm_infocity",$show_array['item']['location']['city']);
		$tpl->assign("mm_infodesc",$des);
		$tpl->assign("nobaidu",$nobaidu);
		$tpl->assign("mm_infopic",$show_array['item']['pic_url']);
		$tpl->assign("mm_cid",$show_array['item']['cid']);

		$tpl->display("mm_info.html","view");		

	}
}
?>